package my.sample.udp.server;

import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.nio.ByteBuffer;

class UDPServer {
	public static void main(String args[]) throws Exception {
		DatagramSocket serverSocket = new DatagramSocket(9876);
		byte[] receiveData = new byte[1524];
		while (true) {
			DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
			serverSocket.receive(receivePacket);
			System.out.println(receivePacket.getLength());
//			ByteBuffer receiveBuffer = ByteBuffer.wrap(receiveData);
//			System.out.println("array length : " + receiveData.length + " bytebuffer details : limit : " + receiveBuffer.limit() + " capacity :" + receiveBuffer.capacity() + " position : " + receiveBuffer.position());;
		}
	}
}